from com.garmin.utils import gos

def _getSrcPath(adbSrc):
    osName = gos.getOSName()
    vaildPath = adbSrc
    # MINGGW32 environment should not contain an "/" in the front
    if osName.find("MINGW32") != -1:
        vaildPath = adbSrc[1:]
    return vaildPath;
def pullTo(src, dest):
    adbSrc = _getSrcPath(src)
    print "Waiting for device connected"
    gos.execute("adb wait-for-device")
    command = "adb pull " + adbSrc + " " + dest;
    result = gos.execute(command)['stderr'];
    temp = result.split('\r\n')
#     for str in temp:
#         if str.find("->") != -1:
#             print str
    